<?php

class UserIdentity extends CUserIdentity
{
	
	public function authenticate()
	{
		if(!isset($this->username) || empty($this->username))
		{
			return false;
		}
		elseif(empty($this->password))
		{
			return false;
		}
		else
		{
			$AdminModel = new AdminModel();
			return $AdminModel
						->with('role')
						->findByAttributes(
								array(
									'admin_name' => $this->username,
									'admin_pass' => md5($this->password)
								), 'status = 1');
		}
		return false;
	}
}